package com.tengju.bff.infrastructure.export.repo;

import com.tengju.bff.infrastructure.export.convert.TableVoConvert;
import com.tengju.bff.interfaces.manage.crm.dealer.facade.ReportDealerInfoFacade;
import com.tengju.bff.interfaces.shared.export.BaseExportQuery;
import com.tengju.bff.interfaces.shared.TableVO;
import com.tengju.export.domain.record.ExportDataSourceRepository;
import com.tengju.export.domain.record.Query;
import com.tengju.export.domain.record.Table;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: 李大仙
 * @date: 2021/8/23 2:39 下午
 */
@Service("targetStarExportDataSourceRepository")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class TargetStarExportDataSourceRepository implements ExportDataSourceRepository {

    private final ReportDealerInfoFacade reportDealerInfoFacade;

    @Override
    public Table batchFindDataSource(Query query) {
        BaseExportQuery exportQuery = (BaseExportQuery) query;
        TableVO tableVO = reportDealerInfoFacade.getTargetStarDealers(exportQuery.getGenSecIdCodes());
        return TableVoConvert.convert(tableVO);
    }
}
